package schedule.model;

import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class FinalSchedule {
	public FinalSchedule(){
		
	}
	
	public BooleanSchedule findCommonMeetingTimes(BooleanSchedule advisor, BooleanSchedule student){
		BooleanSchedule resultSchedule = new BooleanSchedule();
		for (int count=0; count<56; count++){
			if(advisor.getAvailable(count) == true && student.getAvailable(count)==true){
				resultSchedule.setAvailable(count);
			}			
		}
		return resultSchedule;
	}
	//convert both milTimes into boolSchedules, compare them and get resulting boolSchedule, return back resulting milTimeSchedule
	public MilTimeSchedule generateResultMilSchedule(MilTimeSchedule studentDay, MilTimeSchedule adviserDay, int minMeetTime){
		BooleanSchedule studentBoolDay = new BooleanSchedule();
		BooleanSchedule adviserBoolDay = new BooleanSchedule();
		BooleanSchedule resultBool = new BooleanSchedule();
		studentBoolDay.generateSchedule(studentDay);
		adviserBoolDay.generateSchedule(adviserDay);
		resultBool = findCommonMeetingTimes(studentBoolDay, adviserBoolDay);

		MilTimeSchedule result = new MilTimeSchedule();
		result = resultBool.getMilTimeSchedule(minMeetTime);
		return result;
	}
	public MilTimeSchedule generateResultMilSchedule(MilTimeSchedule studentDay, MilTimeSchedule adviserDay){
		MilTimeSchedule result = new MilTimeSchedule();
		result = generateResultMilSchedule(studentDay, adviserDay, 30);
		return result;
	}
	
}
